package com.yyf.springboot2.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yyf.springboot2.entity.TImage;
import com.yyf.springboot2.mapper.TImageMapper;
import com.yyf.springboot2.service.TImageService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author yyf
 * @since 2019-05-29
 */
@Service
@Transactional

public class TImageServiceImpl extends ServiceImpl<TImageMapper, TImage> implements TImageService {

    @Resource
    private TImageMapper imageMapper;

    @Override
    public List<TImage> getNewBannerList(String type) {
        QueryWrapper<TImage> queryWrapper = new QueryWrapper <>();
        Integer bannerType = null;
        if(type.equals("new")){
            bannerType = 1;
            queryWrapper.eq("type",bannerType);
        }
        return imageMapper.selectList(queryWrapper);
    }
}
